package com.amazon.spring8amazon.common;

/**
 * @author: Administrator
 * @date: 2023/9/24 17:50
 * @description:
 */
public class Result {

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    private String code;
    private String msg;
    private Object data;
    private Integer total;

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    private static final String SUCCESS ="0";
    private static final String ERROR ="-1";

    public static Result success() {
        Result result = new Result();
        result.setCode(SUCCESS);
        result.setMsg("success");
        return result;
    }


    public static Result error(String msg) {
        Result result = new Result();
        result.setCode(ERROR);
        result.setMsg(msg);
        return result;
    }



    public static Result success(Object data ) {
        Result result = new Result();
        result.setCode(SUCCESS);
        result.setMsg("success");
        result.setData(data);
        return result;
    }









}
